package <%= packageName %>.security.jwt;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import <%= packageName %>.config.SecurityConfiguration;
import <%= packageName %>.config.SecurityJwtConfiguration;
import <%= packageName %>.config.WebConfigurer;
import <%= packageName %>.management.SecurityMetersService;
<%_ if (!applicationTypeMicroservice) { _%>
import <%= packageName %>.web.rest.AuthenticateController;
<%_ } _%>
<%_ if (reactive && generateBuiltInUserEntity) { _%>
import <%= packageName %>.repository.UserRepository;
<%_ } _%>

import tech.jhipster.config.JHipsterProperties;

<%_ if (reactive) { %>
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

<%_ } else { _%>
import org.springframework.boot.test.context.SpringBootTest;

<%_ } _%>
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
<%_ if (reactive) { %>
@Import(
    {
        JHipsterProperties.class,
        WebConfigurer.class,
        SecurityConfiguration.class,
        SecurityJwtConfiguration.class,
        SecurityMetersService.class,
        JwtAuthenticationTestUtils.class,
    }
)
@WebFluxTest(
<%_ if (applicationTypeMicroservice) { _%>
    controllers = { TestAuthenticationResource.class },
<%_ } else { _%>
    controllers = { AuthenticateController.class },
<%_ } _%>
    properties = {
        "jhipster.security.authentication.jwt.base64-secret=fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8",
        "jhipster.security.authentication.jwt.token-validity-in-seconds=60000",
    }
)
@ComponentScan({})
<%_ } else { _%>
@SpringBootTest(
<%_ if (!applicationTypeMicroservice) { _%>
    properties = {
        "jhipster.security.authentication.jwt.base64-secret=fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8",
        "jhipster.security.authentication.jwt.token-validity-in-seconds=60000",
    },
<%_ } _%>
    classes = {
        JHipsterProperties.class,
        WebConfigurer.class,
        SecurityConfiguration.class,
        SecurityJwtConfiguration.class,
        SecurityMetersService.class,
<%_ if (!applicationTypeMicroservice) { _%>
        AuthenticateController.class,
<%_ } _%>
        JwtAuthenticationTestUtils.class
    }
)
<%_ } _%>
<%_ if (reactive) { %>
@MockitoBean(types = ReactiveUserDetailsService.class)
<%_ } _%>
<%_ if (reactive && generateBuiltInUserEntity) { _%>
@MockitoBean(types = UserRepository.class)
<%_ } _%>
public @interface AuthenticationIntegrationTest {

}
